package com.njts.Polymorphism.player;

import com.njts.Polymorphism.computer.Cable;

/**
 * 我们现在有乒乓球运动员和篮球运动员，乒乓球教练和篮球教练。 为了出国交流，跟乒乓球相关的人员都需要学习英语
 */
public interface Player extends Speakable {

    void play();
}
// 接口和接口的关系:可以继承,多继承
 interface Speakable {
    void speak();
    default void speakEnglish(){
        System.out.println("说英语");
    }
 }
class TableTennisPlayer implements Player,Speakable{
    private String name;
    public TableTennisPlayer(String name){
        this.name=name;
    }
    public void play(){
        System.out.println(name+"打乒乓");
    }

    @Override
    public void speak() {
        System.out.println(name+"说日语");
    }
}

class BasketballPlayer implements Player,Speakable{
    private String name;
    public BasketballPlayer(String name){
        this.name=name;
    }
    public void play(){
        System.out.println(name+"打篮球");
    }

    @Override
    public void speak() {
        System.out.println(name+"说英语");
    }


}
